package com.example.blockbreaker;

import android.app.Application;
import android.util.Log;

import androidx.lifecycle.LiveData;

import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class HealthDataRepository {
    private HealthDataDao healthDataDao;
    private Executor executor;

    public HealthDataRepository(Application application) {
        AppDatabase db = AppDatabase.getDatabase(application);
        healthDataDao = db.healthDataDao();
    }

    public void insert(HealthData healthData) {
        // 使用AppDatabase提供的Executor
        AppDatabase.getExecutor().execute(() -> {
            healthDataDao.insert(healthData);
            Log.d("HealthRepo", "数据已保存: " + healthData);
        });
    }
}